﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.IO;

namespace IconManager.ObjectModel
{
	public abstract class BaseIcon
	{
		private FileInfo file = null;

		/// <summary>
		/// Lazy load the file object
		/// </summary>
		protected FileInfo File
		{
			get
			{
				if (this.file == null)
				{
					this.file = new FileInfo(this.PhysicalPath);
				}

				return file;
			}
		}

		public string FileName { get; protected set; }

		public string Url { get; protected set; }

		public string PhysicalPath { get; protected set; }

		/// <summary>
		/// Gets a value indicating whether the icon file exists
		/// </summary>
		public bool Exists
		{
			get
			{
				return this.File.Exists;
			}
		}

		/// <summary>
		/// Returns the file name without the extension
		/// </summary>
		public string Name
		{
			get
			{
				return this.FileName.Replace(this.File.Extension, string.Empty);
			}
		}
	}
}